<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.html' starting page</title>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" type="text/css" href="../../css/admin.css" />
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript">
window.onload = function() {
	var url = '/storage/admin/pages/loginUser.do?method=getOperatorInfo&d=' + new Date();
	$.getJSON(url, {}, function(data) {
		$('#emp_id').val(data[0].employeeId);
		$('#emp_job_id').val(data[0].employmentId);
		$('#emp_state_id').val(data[0].employeeState);
		
		$('#emp_cid').val(data[0].employeeCid);
		$('#emp_name').val(data[0].employeeName);
		$('#emp_job').val(data[0].employmentName);
		$('#emp_state').val(data[0].employeeState==0?'在岗':'离岗');
		$('#emp_phone').val(data[0].employeeTel);
		$('#emp_address').val(data[0].employeeAdd);
		$('#emp_info').val(data[0].employeeMemo);
	});
};
function on_reset(){
	window.location.reload();
};
function update_operator_info() {
	var emp_id = escape(escape($('#emp_id').val()));
	var emp_job_id = escape(escape($('#emp_job_id').val()));
	var emp_state_id = escape(escape($('#emp_state_id').val()));
	var emp_cid = escape(escape($('#emp_cid').val()));
	var emp_name = escape(escape($('#emp_name').val()));
	var emp_phone = escape(escape($('#emp_phone').val()));
	var emp_address = escape(escape($('#emp_address').val()));
	var emp_info = escape(escape($('#emp_info').val()));

	var true_cid = emp_cid.length<=18;
	if(!true_cid){
		alert("证件号超出范围");
	}
	var true_phone = emp_phone.length<=11;
	if(!true_phone){
		alert("电话超出范围");
	}
	
	if(true_cid&&true_phone){
		var url = '/storage/admin/pages/loginUser.do?method=updateOperator&d=' + new Date();
		url = url + '&emp_id=' + emp_id;
		url = url + '&emp_job_id=' + emp_job_id;
		url = url + '&emp_state_id=' + emp_state_id;
		url = url + '&emp_cid=' + emp_cid;
		url = url + '&emp_name=' + emp_name;
		url = url + '&emp_phone=' + emp_phone;
		url = url + '&emp_address=' + emp_address;
		url = url + '&emp_info=' + emp_info;
		
		$.getJSON(url, {}, function(data) {
			if(data=="true"){
				alert("更新成功");
				window.close();
			}else{
				alert("更新失败");
			}
		});
	}
};
</script>
</head>

<BODY>
<div id="div_header">
  <div id="div_titel">
    个人信息
  </div>
</div>
<!-- 页面主体显示培训班列表 -->
<div style="position:absolute; left:50%; margin-top:2px; margin-left:-115px; text-align:center;">
  <input type="hidden" id="emp_id" value="" />
  <input type="hidden" id="emp_job_id" value="" />
  <input type="hidden" id="emp_state_id" value="" />
  <span style="color:red;">注：红色信息为必要信息</span>
  <table border="0" cellspacing="1" width="230" >
    <tr><td width="60" align="right" style="color:red;" >证件号码&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_cid" /></td></tr>
    <tr><td width="60" align="right" style="color:red;" >姓名&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_name" /></td></tr>
    <tr><td width="60" align="right" >职务&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_job" disabled="disabled" /></td></tr>
    <tr><td width="60" align="right" >状态&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_state" disabled="disabled" /></td></tr>
    <tr><td width="60" align="right" >电话&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_phone" /></td></tr>
    <tr><td width="60" align="right" >地址&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_address" /></td></tr>
    <tr><td width="60" align="right" >备注&nbsp;</td><td width="" ><input style="width:158px; text-align:center;" type="text" id="emp_info" /></td></tr>
    <tr><td colspan="2" align="right" style="padding-right:5px;" ><input type="button" value="重置" onclick="on_reset()" />&nbsp;&nbsp;&nbsp;<input type="button" value="提交" class="submit" onclick="update_operator_info()" style="width:60px;" /></td></tr>  
  </table>
</div>
</body>
</html>
